﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using frontend_wcf.WCFService;

namespace frontend_wcf
{
    public partial class FrmAddUser : Form
    {
        ServiceClient service;

        public FrmAddUser(ServiceClient service)
        {
            this.service = service;
            InitializeComponent();
            rdo_User.Checked = true;
        }

        private void btn_Add_Click(object sender, EventArgs e)
        {
            if (txt_Password1.Text != txt_Password2.Text)
            {
                MessageBox.Show("The two password doesn't match");
                return;
            }
            UserType type = UserType.normal;
            if (rdo_Admin.Checked) type = UserType.admin;
            service.addUser(txt_Username.Text, txt_Password1.Text, type);
        }
    }
}
